package com.milk.controller.user;


import com.milk.entity.UserCollect;
import com.milk.result.Result;
import com.milk.service.UserCollectService;
import com.milk.vo.UserCollectVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("user/userCollect")
@ApiModel(value = "用户收藏接口")
@Slf4j
public class UserCollectController {
    @Autowired
    private UserCollectService userCollectService;

    /**
     * 添加收藏
     * @param userCollect
     * @return
     */
    @PostMapping
    @ApiModelProperty("添加收藏")
    public Result insertUserCollect(@RequestBody UserCollect userCollect){
        log.info("userCollect = {}",userCollect);
        userCollectService.insertUserCollect(userCollect);
        return Result.success();
    }

    /**
     * 查看收藏信息
     * @return
     */
    @GetMapping
    @ApiModelProperty("查看收藏")
    public Result<List<UserCollectVO>> selectUserCollect(){
        return Result.success(userCollectService.selectUserCollect());
    }
}
